<template>
  <div class="htx-menu">
    <el-menu mode="horizontal" router :default-active="currentActive">
      <el-menu-item index="code">
        <i class="el-icon-coffee"></i>
        <span slot="title">代码格式化</span>
      </el-menu-item>
      <el-menu-item index="color">
        <i class="el-icon-brush"></i>
        <span slot="title">颜色转换</span>
      </el-menu-item>
      <el-menu-item index="file">
        <i class="el-icon-document"></i>
        <span slot="title">文件</span>
      </el-menu-item>
      <!-- <el-menu-item index="im">
        <i class="el-icon-chat-line-round"></i>
        <span slot="title">模板IM</span>
      </el-menu-item> -->
      <el-menu-item index="more">
        <i class="el-icon-plus"></i>
        <span slot="title">更多</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
      currentActive: '',
    };
  },
  methods: {
    setDefaultActive() {
      const routerName = this.$route.name.toLowerCase();
      this.currentActive = routerName;
    },
  },
  mounted() {
    this.setDefaultActive();
  },
};
</script>
